package com.example.leave.dao;

import com.example.leave.entity.LeaveFormOperationHistory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;

@Repository
public interface LeaveFromOperationHistoryRepository
        extends JpaRepository<LeaveFormOperationHistory, String>,
        JpaSpecificationExecutor<LeaveFormOperationHistory> {

    Page<LeaveFormOperationHistory> findByUserId(String id, Pageable pageable);

    Page<LeaveFormOperationHistory> findByOperatorAndOperationTimeBetween(String operator, Timestamp start, Timestamp end, Pageable pageable);

    Page<LeaveFormOperationHistory> findByLeaveFormId(String leaveFormId, Pageable pageable);

    Page<LeaveFormOperationHistory> findByLeaveFormIdOrderByOperationTime(String leaveFormId, Pageable pageable);


}
